import pyecharts.options as opts
from pyecharts.charts import Gauge


def gauge01():
    gauge = Gauge(init_opts=opts.InitOpts(width="1600px", height="800px"))
    gauge.add(series_name="业务指标", data_pair=[("完成率", 55.5)])
    gauge.set_global_opts(
        legend_opts=opts.LegendOpts(is_show=False),
        tooltip_opts=opts.TooltipOpts(
            is_show=True, formatter="{a} <br/>{b} : {c}%"),
    )
    gauge.render(path=r"./Exercise/2021-01-23/gauge仪表基础使用.html")


def gauge02():
    gauge = Gauge()
    gauge.add(series_name="业务指标", data_pair=[("", 55.5)], axisline_opts=opts.AxisLineOpts(
        linestyle_opts=opts.LineStyleOpts(color=[(0.3, "#67e0e3"), (0.7, "#37a2da"), (1, "#fd666d")], width=30
                                          )))
    gauge.set_global_opts(
        legend_opts=opts.LegendOpts(is_show=False),
        title_opts=opts.TitleOpts(title="Gauge-不同颜色"),)
    gauge.render(path=r"./Exercise/2021-01-23/gauge仪表盘刻度颜色区分.html")


gauge02()